<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="com.ks.app.navigate.hibernate.KsWebsite"%>
<%@ include file="/commons/taglibs.jsp" %>
<%@ page import="java.util.*" %>
<%@ page import="com.ks.app.navigate.hibernate.KsNavigate" %>
<html>
<head>
 	   <link href="${css}/Public.css" type="text/css" rel="stylesheet" />
       <link href="${css}/PublicEdit.css" type="text/css" rel="stylesheet" /> 
<title>站点信息 </title>
<script>
			function checkData()
			{	
					var name= window.document.getElementById("wname").value;	
			        if(name!=null && name!="")
			        {		
			        	//限制 字符和数字、长度
			        	if(name.length>15)
			        	{
			        	 	alert("中文名过长，最长15位！");
			        	 	window.document.getElementById("wname").focus();
			           		window.event.returnValue = false;
			            	return;
			        	}	  
			        }
			        else
			        {            
			            alert("请输入站点名称！");
			            window.event.returnValue = false;
			            return;
			        }		
					
		 			//验证推荐指数
					var ordernum= window.document.getElementById("wordernum").value;	
			        if(ordernum!=null && ordernum!="")
			        {		
			        	var reg = /^[1-9]\d*$/;	
			       	 	if(!reg.test(ordernum))
			        	{
			        	  	alert("请输入大于0的整数！");
			        	  	window.document.getElementById("wordernum").focus();
			           	 	window.event.returnValue = false;
			            	return;
			        	}	       	       		
			        }
			        else
			        {            
			             alert("请输入推荐指数！");
			             window.event.returnValue = false;
			             return;
			        }				              			       		      
			}						
 </script>		
</head>
<body>

	<% 
				KsWebsite a = (KsWebsite)request.getAttribute("website");  
				List<KsNavigate> navlist=(List<KsNavigate>)request.getAttribute("navlist");
				long id = 0l;
				String name = "";
				String url  = "";
				int status  = 1;
				long navigateid = 0;
				int recommend = 1;
				int ordernum =1;
				if(a != null){
					id = a.getId();
					name = a.getName();
					url  = a.getUrl();
					status = a.getStatus();
					navigateid = a.getNavigateid();
					recommend = a.getRecommend();
					ordernum = a.getOrdernum();
				}
	%>
	
<form action="ks_add_website" method="post" enctype="multipart/form-data">

  				<input type="hidden" id="wid" name="wid" value="<%=id%>""/>
  				<input type="hidden" name="pno" value="${pno}"/>
  				<input type="hidden" name="name" value="${name}"/>
  				<input type="hidden" name="status" value="${status}"/>
  				<input type="hidden" name="navigateid" value="${navigateid}"/>
  				<input type="hidden" name="recommend" value="${recommend}"/>
  				<div>
		                <div class="l_f_top">
		                    <div class="l_f_top_left_div"><img alt="" src="${images}/tb.gif" width="16" height="16" /></div>
		                    <div class="l_f_top_right_div">新增站点        </div>
		                </div>
		                <div class="l_f_body"> 
		                  	<div class="l_f_body_row">
		                        <div class="l_f_body_div1">                            站点名称:</div>
		                        <div class="l_f_body_div5">
				                       <input type="text"  name ="wname" id="wname" value="<%=name==null?"":name%>" style="width:120px"/>  
					           </div>                      
		                    </div>	  		
		                    <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                            站点类型(导航):</div>
		                        <div class="l_f_body_div5" >
		               		     <select name="wnavigateid" id="wnavigateid" style="width: 120px">        
		               		     
		               		     	 <% Iterator<KsNavigate>   git = navlist.iterator();
											while(git.hasNext()){
												KsNavigate n = (KsNavigate)git.next();
												Long navid = n.getId();
												String navname = n.getName();
									 %>
								      	  <option value='<%=navid%>' <%=(navigateid==navid)?"selected='selected'":"" %>><%=navname%></option>
								     <%} %>			         		                
								</select>
							   </div>
		                    </div>          
		                     <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                            优先级:</div>
		                        <div class="l_f_body_div5">
				                       <input type="text"  name ="wordernum" id="wordernum" value="<%=ordernum%>" style="width:120px"/>  
					           </div>                      
		                    </div>	
		                     <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                            站点链接:</div>
		                        <div class="l_f_body_div5">
				                       <input type="text"  name ="wurl" id="wurl" value="<%=url==null?"":url%>" style="width:360px" /> 		                     
					           </div>   
					        </div>
					        <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                            logo图片:</div>
		                        <div class="l_f_body_div5">
		                        	<input type="file" id="logopic" name="logopic"/>				                        			                     	                     
					           </div>   
					        </div>
					         <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                            是否推荐:</div>
		                        <div class="l_f_body_div5">
		                        	<input type="radio" name="wrecommend"  value="2" <%=(recommend==2)?"checked='checked'":"" %>/> 是 
	    							<input type="radio" name="wrecommend"  value="1" <%=(recommend==1)?"checked='checked'":"" %>/> 否	    							
					           </div>                      
		                    </div>	
		                     <div class="l_f_body_row">
		                        <div class="l_f_body_div1">                            用户状态:</div>
		                        <div class="l_f_body_div5" >
		                        	<input type="radio" name="wstatus"  value="2" <%=(status==2)?"checked='checked'":"" %>/> 上线 
	    							<input type="radio" name="wstatus"  value="1" <%=(status==1)?"checked='checked'":"" %>/> 下线	    					
							   </div>
		                    </div>
		                    <div class="center l_f_body_foot">			                     
		                       <input type="submit" id="button" name="button" class="button2_60" onclick="checkData();"  value="提交"/>		                      
		                       <input type="button" class="button2_60"  onclick="javascript:history.go(-1);" value=" 返回"/> 
		                	</div>
		                
			    	</div> 		    	
			   </div>
</form>
</body>
</html>